$.ajaxSetup({
    complete: function (xhr) {
        const resp = xhr.responseJSON;
        console.log(resp,xhr+"111111111111111111111111111111111111111111111111111111111");
        if (resp.code == 403) {
            layui.use("layer", function () {
                layui.layer.msg("你没有登陆，请先登录"), {
                    icon: 2,
                    time: 1000,
                    end: function () {
                        console.log("重新登录");
                        window.parent.location.href = "/login.html";

                    }
                }
            })
        }
    }
})

function dateFormat(date = new Date(), format = "y-m-d h:i:s") {
    if (typeof date == "string") {
        date = new Date(date);
    }
    const y = date.getFullYear(),
        m = _.padStart(date.getMonth() + 1, 2, "0"),
        d = _.padStart(date.getDate(), 2, "0"),
        h = _.padStart(date.getHours(), 2, "0"),
        i = _.padStart(date.getMinutes(), 2, "0"),
        s = _.padStart(date.getSeconds(), 2, "0")
    return format.replace("y", y).replace("m", m).replace("d", d).replace("h", h).replace("i", i).replace("s", s);
}


// $.ajaxSetup({
//     complete: function (xhr) {
//         const resp = xhr.responseJSON;
//         // console.log(resp)
//         if (resp.code == 403) {
//             layui.use("layer", function () {
//                 layui.layer.msg("你没有登陆，请先登陆！", {
//                     icon: 2,
//                     time: 1000,
//                     end: function () {
//                         window.parent.location.href = "/login.html";
//                         console.log(resp.code + "======================================");
//                     }
//                 })
//             })
//         }
//     }
// })